#include <stdio.h>
#include<stdbool.h>
/* 1990年1月1日 是星期一 */
int get_monthdays(int month,bool leap)
{
    int days=0;
    int mondays[]={0,31,28+!!leap,31,30,31,30,31,31,30,31,30,31};
    for(int i=0;i<month;i++)
    {
        days+=mondays[i];
    }
    return days;
}
bool is_valid(int year,int month,int day)
{
    if(year<1990)
    {
        return false;
    }
    if(month<1||month>12)
    {
        return false;
    }
    if(day>30||day<1)
    {
        return false;
    }
    return true;
}
bool is_leap(int year)
{
    return((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}
int main()
{
    int year, month, day, week, leap;
    int sum = 0;
    int i;
    scanf("%d/%d/%d", &year, &month, &day);
    if(is_valid(year,month,day)==false)
    {
        printf("信息有误！\n");
        return 1;
    }
    for (i = 1990; i < year; i++)
    {
        if (is_leap(i))
        {
            sum += 366;
        }
        else
        {
            sum += 365;
        }
    }
    if (is_leap(year))
    {
        leap = 1;
    }
    else
    {
        leap = 0;
    }
    sum+=get_monthdays(month,leap);
    sum += day;
    week = sum % 7;
    char *weekday[]={"日","一","二","三","四","五","六" };
    printf("%d年%d月%d日是星期%s\n", year, month, day, weekday[week]);
}
